﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BestTrader.Cms.IServices;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BestTrader.Cms.WebApi.Controllers.v1
{
    [ApiVersion("1.0")]
    [Route("api/v{version:apiVersion}/[controller]")]
    [ApiController]
    public class RmmfController : BaseController
    {
        private readonly IBatchService _batchService;

        public RmmfController(IBatchService batchService)
        {
            this._batchService = batchService;
        }

        /// <summary>
        /// 1.0 同步风软历史记录
        /// </summary>
        [ApiExplorerSettings(IgnoreApi = true)]
        [HttpGet("HistoryDealedOrderReport")]
        public IActionResult Init()
        {
            // http://192.168.18.20:50003/api/v1/Rmmf/HistoryDealedOrderReport
            _batchService.RmmfHistoryDealedOrderReportAsync();

            return Content("OK");
        }

        /// <summary>
        /// 2.0 生成返佣记录
        /// </summary>
        [ApiExplorerSettings(IgnoreApi = true)]
        [HttpGet("InstanceRebateRecord")]
        public IActionResult Record()
        {
            // http://192.168.18.20:50003/api/v1/Rmmf/InstanceRebateRecord
            _batchService.GetRebateRecord();

            return Content("OK");
        }

        /// <summary>
        /// 3.0 生成历史出入金记录
        /// </summary>
        [ApiExplorerSettings(IgnoreApi = true)]
        [HttpGet("HistoryCashReport")]
        public IActionResult InitCash()
        {
            // http://192.168.18.20:50003/api/v1/Rmmf/HistoryCashReport
            _batchService.RmmfCashHistoryReportAsync();

            return Content("OK");
        }

    }
}